#ifndef SB_H
#define SB_H

#define SB_MAX_FRAG_LENGTH 4096

typedef struct _StringBuilder {
    int length;
    char *str;
} StringBuilder;

StringBuilder *sb_new();
void sb_free(StringBuilder *sb);

/**
 * 把字符串添加到StringBuilder的末尾，返回当前长度，返回-1表示添加失败
 */
int sb_append(StringBuilder *sb, const char *s);
#endif
